package com.epoint.mobileoa.ui.wsgw.task;

import java.util.Map;

import android.os.Message;

import com.epoint.mobileoa.R;
import com.epoint.mobileoa.bizlogic.NewTask;
import com.epoint.mobileoa.bizlogic.SuperView;
import com.epoint.mobileoa.tools.WebServiceUtilDAL;
import com.epoint.mobileoa.ui.wsgw.model.AttFileInfoModel;

/**
 * @author liyc
 * @time 2012-12-18 下午3:30:20
 * @annotation 
 */
public class GetAttachTask extends NewTask {

	

	/**
	 * @param sv
	 * @param taskID
	 * @param param
	 * @param progressMsg
	 * @param progressDialogType
	 */
	public GetAttachTask(SuperView sv, int taskID, Map<String, Object> param,
			String progressMsg, int progressDialogType) {
		super(sv, taskID, param, progressMsg, progressDialogType);
	}

	@Override
	public void exectue(Message mess) throws Exception {
		AttFileInfoModel a = (AttFileInfoModel) getParam().get("model");

		String url = sv.getString(R.string.gw_ws_url);
		String namespace = sv.getString(R.string.WS_namespace);
		String method = "Handle_GetAttach";
		WebServiceUtilDAL webservice = new WebServiceUtilDAL(url,
				method, namespace);

		String ParasXml = "<?xml version=\"1.0\" encoding=\"gb2312\"?>"+
				"<paras>"+
				"<UserGuid>%s</UserGuid>"+
				"<AttachGuid>%s</AttachGuid>"+
				"</paras>";
		ParasXml = String.format(ParasXml,getSv().fp.getUserguid(),a.AttachGuid);
		webservice.addProperty("ValidateData", sv.getString(R.string.WS_ValidateData));
		webservice.addProperty("ParasXml", ParasXml);
//		String attachguidtag = "<AttachGuid>"+a.AttachGuid+"</AttachGuid>";
		String bs = webservice.start();
		setMessageToRefreshUI(mess,bs);
	}

}
